<template>
  <a-spin :spinning="loading">
    <div class="materialsAudit-container">
      <BaseAudit
        ref="baseAudit"
        :is-need-details="true"
        :button-config="{
          no: {
            isShow: isShow,
            title: '审批不通过'
          },
          ok: {
            isShow: true,
            title: isShow?'审批通过':'审批'
          }
        }"
        :callback-fn="callbackFn"
      />
      <!-- <TotalPackageContractAdd
      v-if="isShow"
      :is-audit="true"
    /> -->
    </div>
  </a-spin>
</template>

<script>
/*
 * 总包合同审批分公司审批专用
 * */
import BaseAudit from '../BaseAudit'
import TotalPackageContractAdd from '@/views/Legal/branchContract/totalPackageContract/add'

export default {
    name: 'TotalPackageAudit',
    components: {
        BaseAudit
        // TotalPackageContractAdd
    },
    data() {
        return {
            isShow: false,
            loading: false
        }
    },
    created() {
        let taskDefKey = this.$route.query.taskDefKey
        switch (taskDefKey) {
            case 'legal_general_branchcom_economics':
            case 'legal_general_branchcom_manager':
                this.isShow = true
                break

            default:
                break
        }
        // switch (taskDefKey) {
        //     case 'legal_general_branchcom_basic':
        //     case 'legal_general_branchcom_project':
        //     case 'legal_general_branchcom_finance':
        //     case 'legal_general_branchcom_legal':
        //     case 'legal_general_branchcom_business':
        //     case 'legal_general_branchcom_science':
        //     case 'legal_general_branchcom_economics':
        //     case 'legal_general_branchcom_manager':
        //         this.isShow = true
        //         break
        //     case 'legal_general_branchcom_legal_adviser':
        //     case 'legal_general_branchcom_economics':
        //     case 'legal_general_branchcom_manager':
        //         this.isShow = false
        //         break
        //     default:
        //         break
        // }
    },
    mounted() {
        this.$bus.$on('handelApprovalCopy', () => {
            this.loading = false
        })
        this.$bus.$on('loading', () => {
            this.loading = true
        })
        this.$bus.$on('unloading', () => {
            this.loading = false
        })
        
    },
    methods: {
        callbackFn(type) {
            
            if (this.isShow) {
                return type !== 'approval'
            }
            return null
        }
    }
}
</script>

<style lang='less' scoped>
.materialsAudit-container {
    .counterSign-box,
    .main-box,
    .releated-box,
    .project-box {
        display: flex;
        align-items: center;
        padding: 12px 0;

        .tag {
            height: 32px;
            line-height: 32px;
        }
    }
}
</style>